// Creates a Rect
//
// type:
// 	- "fill"  
// 	- "stroke", "box" (default)
// 	- "clear"
function CGERect ( type )
{
	switch ( type )
	{
		case "fill": 
			this.type = "fillRect";
			break;
		case "clear":
			this.type = "clearRect";
			break;
		default:
			this.type = "strokeRect";
	}

	this.col_fill = "#000000";
	this.col_stroke = "#ff00ff";
	this.line_width = 1;

	this.x = 0;
	this.y = 0;
	this.w = 100;
	this.h = 100;
}

CGERect.prototype.set_size = function ( w, h )
{
	this.w = w;
	this.h = h;
};

CGERect.prototype.draw = function ( x, y )
{
	if ( x === undefined ) x = this.x;
	if ( y === undefined ) y = this.y;

	this.x = x; this.y = y;

	CGE.canvas.ctxt.fillStyle = this.col_fill;
	CGE.canvas.ctxt.strokeStyle = this.col_stroke;
	CGE.canvas.ctxt.lineWidth = this.line_width;
	CGE.canvas.ctxt [ this.type ] ( this.x, this.y, this.w, this.h );
};
